//
//  NewsTableViewCell.m
//  OurRelaxDemo
//
//  Created by 鳕鱼 on 15-6-25.
//  Copyright (c) 2015年 于宾尧. All rights reserved.
//

#import "NewsTableViewCell.h"

@implementation NewsTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self  = [super  initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self chushihua];
    }
    return self;
    
}

- (void )chushihua
{
    
    
    
    
    self.myinageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@""]];
    //self.myinageView.frame = CGRectMake(self.contentView.frame.origin.x , self.contentView.frame.origin.y + 10, self.contentView.frame.size.width+55  , self.contentView.frame.size.height + 170 );
    if ([[UIScreen mainScreen] bounds].size.width == 375) {
        
        self.myinageView.frame = CGRectMake(self.contentView.frame.origin.x, self.contentView.frame.origin.y + 10, self.contentView.frame.size.width + 55, self.contentView.frame.size.height + 170);
        
    } else if ([[UIScreen mainScreen] bounds].size.width > 375) {
    
        self.myinageView.frame = CGRectMake(self.contentView.frame.origin.x + 8, self.contentView.frame.origin.y + 10, self.contentView.frame.size.width + 78, self.contentView.frame.size.height + 170);
    } else {
    
        self.myinageView.frame = CGRectMake(self.contentView.frame.origin.x, self.contentView.frame.origin.y + 10, self.contentView.frame.size.width + 55, self.contentView.frame.size.height + 170);
    }
    //    self.myinageView.backgroundColor = [UIColor orangeColor];
    
    [self addSubview:self.myinageView];
    
    
    //UIView *viewq = [[UIView alloc]initWithFrame:CGRectMake( self.contentView.frame.origin.x  , self.myinageView.frame.origin.y + 180 ,self.contentView.frame.size.width+55 , 34)];
    //viewq.backgroundColor = [UIColor blackColor];
    //viewq.alpha = 0.5;
    
    //[self addSubview:viewq];
    
    
    UIView *viewq1 = [[UIView alloc]initWithFrame:CGRectMake( self.contentView.frame.origin.x  , self.myinageView.frame.origin.y + 214 ,self.contentView.frame.size.width+55 , 25)];
    //    viewq1.backgroundColor = [UIColor blackColor];
    viewq1.alpha = 0.5;
    
    [self addSubview:viewq1];
    
    
    if ([[UIScreen mainScreen] bounds].size.width == 375) {
        
        self.myLable = [[UILabel alloc]initWithFrame:CGRectMake(self.contentView.frame.origin.x  , self.myinageView.frame.size.height - 30 ,self.contentView.frame.size.width+55 , 40)];
        
    } else if ([[UIScreen mainScreen] bounds].size.width > 375) {
    
        self.myLable = [[UILabel alloc] initWithFrame:CGRectMake(self.myinageView.frame.origin.x, self.myinageView.frame.size.height - 30, self.myinageView.frame.size.width, 40)];
    } else {
    
        self.myLable = [[UILabel alloc] initWithFrame:CGRectMake(self.contentView.frame.origin.x, self.myinageView.frame.size.height - 30, self.contentView.frame.size.width, 40)];
        self.myLable.font = [UIFont systemFontOfSize:15.0];
    }
    self.myLable .backgroundColor = [UIColor darkGrayColor];
    self.myLable.textColor = [UIColor whiteColor];
    
    [self addSubview: self.myLable];
    
    self.mybutton = [UIButton buttonWithType:UIButtonTypeSystem];
    
    
    
    if ([[UIScreen mainScreen] bounds].size.width >= 375) {
        
        self.myLable1 = [[UILabel alloc]initWithFrame:CGRectMake(self.contentView.frame.origin.x + 30 , self.myinageView.frame.origin.y + 214 ,self.contentView.frame.size.width+20 , 25)];
        
    }else {
    
        self.myLable1 = [[UILabel alloc] initWithFrame:CGRectMake(self.contentView.frame.origin.x + 30, self.myinageView.frame.origin.y + 214, self.contentView.frame.size.width , 25)];
        self.myLable1.font = [UIFont systemFontOfSize:15.0];
    }
    //    self.myLable .backgroundColor = [UIColor yellowColor];
    //    self.myLable1.textColor = [UIColor whiteColor];
    
    self.myLable1.  alpha = 0.5;
    
    
    [self addSubview: self.myLable1];
    
    
    //    self.mybutton = [UIButton buttonWithType:UIButtonTypeSystem];
    //    [self.mybutton setImage:[UIImage imageNamed:@"/Users/dlios/OurRelax/OurRelaxDemo/iconfont-bofang-2.png"] forState:UIControlStateNormal];
    //
    //    self.mybutton.center = self.center;
    
    //    [self.mybutton addTarget:self action:@selector(asd) forControlEvents:UIControlEventTouchUpInside];
    
    
    //    [self addSubview: self.mybutton];
    
    UIImageView *imaaa = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"/Users/dlios/OurRelax/OurRelaxDemo/iconfont-bofang-2.png"]];
    imaaa.center = self.myinageView.center;
#warning 1 注掉的原来
    [self addSubview:imaaa];
    
    
    
    
    
}

//- (void)asd
//{
//////    NSURL *url = [NSURL fileURLWithPath:filePath];
////    NSURL *url = [NSURL URLWithString:self.news.video_length];
////    // 使用本地url资源初始化播放器
////    self.player = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
////    // MPMovieScalingModeAspectFit 视频按比例填在View上，保持宽高比
////    // MPMovieScalingModeFill 视频不考虑高宽比而是单独针对水平轴和垂直轴进行缩放
////    [_player.moviePlayer setScalingMode:MPMovieScalingModeAspectFit];
////    [_player.moviePlayer setControlStyle:MPMovieControlStyleFullscreen];
//////    [self  addSubview:_player.view];
//////    [_player.view setFrame:CGRectMake(50, 50, 220, 220)];
////    //    CGAffineTransform landscapeTransform = CGAffineTransformMakeRotation(M_PI/2);
////    //    _player.view.transform = landscapeTransform;
////      [self presentMoviePlayerViewControllerAnimated:_player];
////    [_player.moviePlayer play];//播放
////
////    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(doFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
////    // 通知方法为“视频播放结束”，回应方法为doFinished 也就是说，当视频播放结束以后，运行该方法





- (void)setNews:(NewsModel *)news
{
    if (_news != news) {
        [_news release];
        
        _news  = [news retain];
    }
    self.myLable.text = self.news.title;
    NSLog(@"========%@",self.news.title);
    NSURL *url = [NSURL URLWithString:self.news.feature_img];
    [self.myinageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"picholder.png"]];
    self.myLable1.text = self.news.video_length;
    self.wangzhi = self.news.video_link;
    self.newid = self.news.feed_id;
    
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
